package org.example;

import java.lang.reflect.Field;

public class eqwqe {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException, InstantiationException, IllegalAccessException {
        Class<?> a = Class.forName("org.example.User");
        Object o = a.newInstance();
        Field name = a.getDeclaredField("name");
        name.setAccessible(true);
        System.out.println(name.get(o));
        name.set(o,"陈玮");
        System.out.println(name.get(o));
    }
}

class User{
    private String name="阮钊";
}